/**
 * @param {number[]} nums
 * @return {number[]}
*/
var decompressRLElist = function(nums) {
  let result = [];
  for(let i = 0; i < nums.length; i += 2) {
    result = result.concat(new Array(nums[i]).fill(nums[i + 1]));
  }
  return result;
};
let nums = [1,2,3,4];
console.log(decompressRLElist(nums));
nums = [1,1,2,3];
console.log(decompressRLElist(nums));
